#include <bits/stdc++.h>

using namespace std;

int t,n,m,l,v;
int d[100010],v1[100010],a[100010],p[100010];

int main()
{
    ifstream fin("detect.in");
    ofstream fout("detect.out");

    scanf("%d\n", &t);
    scanf("%d %d %d %d\n", &n, &m, &l, &v);
    for(int i = 1; i <= n; i++){
        scanf("%d %d %d\n", &d[i], &v1[i], &a[i]);
    }
    for(int i = 1; i <= n; i++) {
        scanf("%d", &p[i]);
    }

    fin.close();
    fout.close();
    return 0;
}
